Implement Updating a Todo Item
Takeaways
An update involves setting the attributes of an existing object in the database.
In SQL:
UPDATE table_name
SET column1 = value1, column2 = value2, ...
WHERE condition;
In SQLAlchemy ORM:
user = User.query.get(some_id)
user.name = 'Some new name'
db.session.commit()
Using the Jinja if statement
Check out the Jinja Docs
Next up: adding update functionality to our Todo App
Feel free to use the interactive workspace below to follow along the walk-throughs ahead in this lesson in adding update functionality to your Todo app. Have this page open in a separate tab or window, so you can continue to use it throughout the concepts in this lesson.